import java.util.HashMap;
import java.util.Map;

import org.apache.commons.codec.digest.DigestUtils;

import com.fasterxml.jackson.core.JsonProcessingException;

import cn.com.jansh.core.util.HttpClientRequest;
import cn.com.jansh.core.util.HttpClientUtil;
import cn.com.jansh.core.util.JsonUtil;
import cn.com.jansh.core.util.StringUtil;

public class test {
	public static void main(String[] args) {
		try {
			Map<String, String> paramMap = new HashMap<String,String>();
			paramMap.put("sysid", "pJy0Jt04RGAY");
			paramMap.put("cporder", "1465461435456");
			paramMap.put("phone", "13337459638");
			//paramMap.put("ispno", "lt");
			paramMap.put("isptype", "ll");
			paramMap.put("facevalue", "20M");
			//paramMap.put("province", "qg");
			
//			String orderUrl = "http://192.168.23.12:8080/cf-server/rechargeinter/order";
			String orderUrl = "http://127.0.0.1:8080/cf-manage/qcell/qcell";
			//String queryOrderUrl = "http://192.168.23.12:8080/cf-manage/rechargeinter/queryorder";
			
			HttpClientRequest request = gethttpClientRequest(paramMap);
			String sss = HttpClientUtil.httpPost(orderUrl, request);
			
			System.out.println("+++++++++++++++++++++++++++++++++++++++"+sss);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private static HttpClientRequest gethttpClientRequest(Map<String, String> map) throws JsonProcessingException{
		String json = JsonUtil.obj2json(map);
		String salt = StringUtil.randomCharNum(8);
		String source = salt + json + "130213";
		String digest = DigestUtils.md5Hex(source);
		HttpClientRequest request = new HttpClientRequest();
		Map<String, String> headers = new HashMap<>();
		headers.put("JANSHAUTH", salt + digest);
		request.setHeaders(headers);
		request.setBody(json);
		return request;
	}
}

